@extends('admin.layout.layout')
@section('title')
    <title>北京仁爱慈善基金CMS管理系统 >> 项目分类首页</title>
@endsection
@section('con')
    <div class="row">
    @if (session('success'))
	    
	    <div id="successInfo" class="alert alert-success alert-dismissable col-xs-4 col-xs-offset-3" style="position: absolute;top: 70px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            {{ session('success') }}
        </div>     
	@endif
	@if (session('error'))

	    <div id="errorInfo" class="alert alert-danger alert-dismissable col-xs-4 col-xs-offset-3" style="position: absolute;top: 70px;">
	    <div id="errorInfo" class="alert alert-success alert-dismissable col-xs-4 col-xs-offset-3" style="position: absolute;top: 70px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            {{ session('error') }}
        </div>     
	@endif
        <div class="col-lg-12">
            <h1 class="page-header">项目分类列表</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
	<div class="row"> 
   <div class="col-lg-12"> 
    <div class="panel panel-default"> 
     <div class="panel-heading">
        
     </div> 
     <!-- /.panel-heading --> 
     <div class="panel-body"> 
      <div class="dataTable_wrapper"> 
       <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
        <div class="row">
         <div class="col-sm-6">
         <form action="{{asset('/admin/ptype/index')}}" method="get">
          <div class="dataTables_length" id="dataTables-example_length">
           <label>每页显示<select aria-controls="dataTables-example" class="form-control input-sm" name="strip">
           <option value="10" @if(!empty($pages['strip']) && $pages['strip'] == '10') selected @endif>10</option>
           <option value="25" @if(!empty($pages['strip']) && $pages['strip'] == '25') selected @endif>25</option>
           <option value="50" @if(!empty($pages['strip']) && $pages['strip'] == '50') selected @endif>50</option>
           <option value="100" @if(!empty($pages['strip']) && $pages['strip'] == '100') selected @endif>100</option>
           </select>条</label>
          </div>
         </div>
         <div class="col-sm-6">
          <div id="dataTables-example_filter" class="dataTables_filter">
           <label>查询:<input type="search" class="form-control input-sm" placeholder="" aria-controls="dataTables-example"  name="keywords"/ value="{{$pages['keywords'] or ''}}"></label>
           <button type="submit" class="btn btn-outline btn-primary">搜索</button>
          </div>
         </div>
         </form>
        </div>
        <div class="row">
         <div class="col-sm-12">
          <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" role="grid" aria-describedby="dataTables-example_info"> 
           <thead> 
            <tr role="row">
             <th class="sorting_desc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column ascending" aria-sort="descending" >项目分类ID</th>
             <th class="sorting_desc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column ascending" aria-sort="descending" >项目分类名称</th>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" >LOGO</th>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">项目描述</th>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">显示状态</th>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width:100px; ">操作</th>
            </tr> 
           </thead> 
           <tbody> 

           @foreach($datas as $k => $v)
            @if($v->pid == 0)
               <tr class="gradeA odd ptype" role="row"> 
               <td class="sorting_1">{{$v->id}}</td>
               <td class="center">{{$v->pname}}</td>  
               <td class="center"><img src="" alt="我们的项目" width="100px"></td>
               <td class="center">{{$v->expl}}</td>
               <td class="center">{{$status[$v->status]}}</td> 
               <td class="center">
               <div class="row">
                <div class="col-sm-7 col-sm-offset-3" style="line-height: 40px;">               
                 <a href="{{url('/admin/ptype/del',['id'=>$v->id])}}"><button type="button" class="btn btn-danger btn-xs del-p">删除</button></a> 
                 <a href="{{url('/admin/ptype/edit',['id'=>$v->id])}}"><button type="button" class="btn btn-warning btn-xs">修改</button></a>      
                </div>
               </div>
               </td> 
              </tr>
            @endif
            @if($v->pid != 0)
            <tr class="gradeA odd ptype" role="row"> 
             <td class="sorting_1">{{$v->id}}</td>
             <td class="center">{{$v->pname}}</td>  
             <td class="center"><img src="{{asset($v->logo)}}" alt="我们的项目" width="100px"></td>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" >操作</th>
            </tr> 
           </thead> 
           <tbody> 
           @foreach($datas as $k => $v)
            <tr class="gradeA odd ptype" role="row"> 
             <td class="sorting_1">{{$v->id}}</td>
             <td class="center">{{$v->pname}}</td>  
             <td class="center"><img src="{{asset($v->logo)}}" alt="" width="100px"></td> 
             <td class="center">{{$v->expl}}</td>
             <td class="center">{{$status[$v->status]}}</td> 
             <td class="center">
             <div class="row">
             	<div class="col-sm-7 col-sm-offset-3" style="line-height: 40px;">            		
		           <a href="{{url('/admin/ptype/del',['id'=>$v->id])}}"><button type="button" class="btn btn-danger btn-xs del-p">删除</button></a> 
		           <a href="{{url('/admin/ptype/edit',['id'=>$v->id])}}"><button type="button" class="btn btn-warning btn-xs">修改</button></a>      
             	<div class="col-sm-7 col-sm-offset-3">            		
		           <a href="{{url('/admin/ptype/del',['id'=>$v->id])}}"><button type="button" class="btn btn-danger btn-sm del-p">删除</button></a> 
		           <a href="{{url('/admin/ptype/edit',['id'=>$v->id])}}"><button type="button" class="btn btn-warning btn-sm">修改</button></a>      
             	</div>
             </div>
             </td> 
            </tr>
            @endif
            @endforeach
           </tbody> 
          </table>
         </div>
        </div>
       <div class="row">
          <div class="col-sm-6">
          	 {!! $datas->appends($pages)->render() !!}
          </div>
       </div>
       </div> 
      
      <!-- /.table-responsive --> 
     </div> 
     <!-- /.panel-body --> 
    </div> 
    <!-- /.panel --> 
   </div> 
   <!-- /.col-lg-12 --> 
  </div>
@endsection
@section('js')
	<script>
	
		// 限制时间
	  setTimeout(function(){
	  	$('#successInfo').hide(1000);
	  	$('#errorInfo').hide(1000);
	  },2000);

	  
	</script>
@endsection